<v-expansion-panel expand>
  <v-expansion-panel-content
    v-for="(source, index) in datasets"
    v-show="source !== proxyToDelete"
    :key="source.getProxyId()"
    :class="$style.datasetPanel"
    :value="true"
  >
    <color-group
      :index="index"
      :visible="datasets.length > 1"
      :top="53"
    />
    <div
      slot="header"
      v-bind:title="source.getName()"
      :class="$style.datasetHeader"
    >
      <v-btn
        :class="$style.headerMenuButton"
        icon
        small
        v-on:click.stop="toggleDatasetVisibility(source)"
      >
        <v-icon>
          {{ getDatasetVisibility(source) ? 'visibility' : 'visibility_off' }}
        </v-icon>
      </v-btn>
      <div
        class="body-2"
        :class="$style.source"
      >{{ source.getName() }}</div>
      <v-tooltip
        v-if="proxyManager.getSources().length > 1"
        top
        :disabled="smallScreen"
      >
        <span :class="$style.noSelect">Activate source</span>
        <v-btn
          slot="activator"
          :class="$style.headerMenuButton"
          icon
          small
          v-on:click.stop="source.activate()"
        >
          <v-icon>{{ proxyManager.getActiveSource() === source ? 'bookmark' : 'bookmark_border' }}</v-icon>
        </v-btn>
      </v-tooltip>
      <div v-on:click.stop> <!-- prevent panel expansion on menu click -->
        <v-menu offset-x>
          <v-btn
            slot="activator"
            :class="$style.headerMenuButton"
            icon
            small
          >
            <v-icon>more_vert</v-icon>
          </v-btn>
          <v-list dense>
            <v-list-tile
              v-on:click="deleteDataset(source)"
            >
              <v-list-tile-title>Delete</v-list-tile-title>
            </v-list-tile>
          </v-list>
        </v-menu>
      </div>
    </div>
    <v-card :class="$style.datasetControls">
      <v-expansion-panel expand>
        <template v-for="panel in panels">
          <component
            :is="panel"
            :key="panel.name"
            :source="source"
          />
        </template>
      </v-expansion-panel>
    </v-card>
  </v-expansion-panel-content>
</v-expansion-panel>
